using System;
using NUnit.Framework;
using DotNetXmlSwfChart;

namespace DotNetXmlSwfChart.UnitTest
{
    [TestFixture]
    public class ChartGridFixture
    {
        [Test]
        public void HorizontalDashedToSourceXml()
        {
            string testXml =
                "<chart_grid_h thickness='1' " +
                              "color='ffffff' " +
                              "alpha='2' " +
                              "type='dashed' " +
                              "/>";
            ChartGrid cg = new ChartGrid(ChartGridType.Horizontal);
            cg.Thickness = 1;
            cg.Color = "ffffff";
            cg.Alpha = 2;
            cg.GridLineType = ChartGridLineType.dashed;
            Assert.AreEqual(testXml, cg.ToSourceXML());
        }

        [Test]
        public void HorizontalDottedToSourceXml()
        {
            string testXml =
                "<chart_grid_h thickness='1' " +
                              "color='ffffff' " +
                              "alpha='2' " +
                              "type='dotted' " +
                              "/>";
            ChartGrid cg = new ChartGrid(ChartGridType.Horizontal);
            cg.Thickness = 1;
            cg.Color = "ffffff";
            cg.Alpha = 2;
            cg.GridLineType = ChartGridLineType.dotted;
            Assert.AreEqual(testXml, cg.ToSourceXML());
        }
        
        [Test]
        public void HorizontalSolidToSourceXml()
        {
            string testXml =
                "<chart_grid_h thickness='1' " +
                              "color='ffffff' " +
                              "alpha='2' " +
                              "type='solid' " +
                              "/>";
            ChartGrid cg = new ChartGrid(ChartGridType.Horizontal);
            cg.Thickness = 1;
            cg.Color = "ffffff";
            cg.Alpha = 2;
            cg.GridLineType = ChartGridLineType.solid;
            Assert.AreEqual(testXml, cg.ToSourceXML());
        }

        [Test]
        public void VerticalDashedToSourceXml()
        {
            string testXml =
                "<chart_grid_v thickness='1' " +
                              "color='ffffff' " +
                              "alpha='2' " +
                              "type='dashed' " +
                              "/>";
            ChartGrid cg = new ChartGrid(ChartGridType.Vertical);
            cg.Thickness = 1;
            cg.Color = "ffffff";
            cg.Alpha = 2;
            cg.GridLineType = ChartGridLineType.dashed;
            Assert.AreEqual(testXml, cg.ToSourceXML());
        }

        [Test]
        public void VerticalDottedToSourceXml()
        {
            string testXml =
                "<chart_grid_v thickness='1' " +
                              "color='ffffff' " +
                              "alpha='2' " +
                              "type='dotted' " +
                              "/>";
            ChartGrid cg = new ChartGrid(ChartGridType.Vertical);
            cg.Thickness = 1;
            cg.Color = "ffffff";
            cg.Alpha = 2;
            cg.GridLineType = ChartGridLineType.dotted;
            Assert.AreEqual(testXml, cg.ToSourceXML());
        }

        [Test]
        public void VerticalSolidToSourceXml()
        {
            string testXml =
                "<chart_grid_v thickness='1' " +
                              "color='ffffff' " +
                              "alpha='2' " +
                              "type='solid' " +
                              "/>";
            ChartGrid cg = new ChartGrid(ChartGridType.Vertical);
            cg.Thickness = 1;
            cg.Color = "ffffff";
            cg.Alpha = 2;
            cg.GridLineType = ChartGridLineType.solid;
            Assert.AreEqual(testXml, cg.ToSourceXML());
        }
    }
}
